package vip.liux.front.infrastructure.jpa.product;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import vip.liux.contracts.models.product.Category;
import vip.liux.contracts.repositories.product.CategoryRepository;

public interface CategoryJpaRepository extends JpaRepository<Category, Long>, CategoryRepository {

    @Query("select count(c) > 0 from Category c where c.parentNo in (select cd.catNo from Category cd where cd.id = :id)")
    @Override
    boolean existsChildren(Long id);
}